#include "src/defines/functions.h"

#include <cmath>

double Functions::toRad(double _x)
{
    return (_x * M_PI)/180.0;
}

double Functions::max(double _x, double _y, double _z)
{
    if(_x > _y){
        if(_x > _z)
            return _x;
    }
    else
    {
        if(_y > _z)
            return _y;
    }
    return _z;
}

Vector3D Functions::sphericalCoordinates(double _phi, double _theta)
{
    double sinPhi = sin(Functions::toRad(_phi));
    double cosPhi = cos(Functions::toRad(_phi));
    double sinTheta = sin(Functions::toRad(_theta));
    double cosTheta = cos(Functions::toRad(_theta));

    //a direção é de acordo com uma esfera
    return Vector3D( sinPhi * cosTheta, sinPhi * sinTheta, cosPhi);
}
